home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / brix.dec < prev    next >
Text File  |  1995-03-23  |  12KB  |  189 lines

  1. Article 1307 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!cs.utexas.edu!milano!lad-shrike!vervalin
  3. From: vervalin@AUSTIN.LOCKHEED.COM (Paul Vervalin)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: BRIX decoded
  6. Keywords: CHIP48 BRIX
  7. Message-ID: <364@shrike.AUSTIN.LOCKHEED.COM>
  8. Date: 15 Sep 90 06:33:25 GMT
  9. Organization: Lockheed Austin Div.
  10. Lines: 175
  11.  
  12.  
  13. Below is a detailed description of the BRIX game that is run with the CHIP48
  14. interpreter.  I hope this helps others when writing programs using CHIP48.
  15. All of this is hand typed so please forgive me if there are any typos. 
  16. Happy programming!!
  17.  
  18.   register          contents
  19. ------------------------------------------------------
  20.     V0        scratch
  21.     V1        scratch
  22.     V2        scratch
  23.     V3        X coordinate of score
  24.     V4        Y coordinate of score
  25.     V5        bricks hit counter
  26.     V6        ball X coordinate
  27.     V7        ball Y coordinate
  28.     V8        ball X direction
  29.     V9        ball Y direction
  30.     VA        X coordinate when generating bricks
  31.     VB        Y coordinate when generating bricks
  32.     VC        paddle X coordinate
  33.     VD        paddle Y coordinate
  34.     VE        ball counter
  35.     VF        collision detect
  36.  
  37. address  instruction  code                      comment
  38. --------------------------------------------------------------------------------
  39.   200      6E05      VE=05                     set # balls to 5
  40.   202      6500      V5=00                     init. bricks hit to zero
  41.   204      6B06      VB=06                     set Y position of first brick
  42.   206      6A00      VA=00                     set X position of first brick
  43.   208      A30C      I=30C                     set address of brick sprite
  44.   20A      DAB1      DRAW VA VB 1 BYTE         draw brick sprite at loc. VA VB
  45.   20C      7A04      VA=VA+4                   move along X to next brick loc.
  46.   20E      3A04      IF VA=4 SKIP NEXT         if location wrapped goto next row
  47.   210      1208      JUMP 208                  otherwise draw another
  48.   212      7B02      VB=VB+2                   move down Y to next row
  49.   214      3B12      IF VB=12 SKIP NEXT        if all rows drawn continue on
  50.   216      1206      JUMP 206                  otherwise draw next row
  51.   218      6C20      VC=20                     set X coordinate of paddle
  52.   21A      6D1F      VD=1F                     set Y coordinate of paddle
  53.   21C      A310      I=310                     get address of paddle sprite
  54.   21E      DCD1      DRAW VC VD 1 BYTE         draw paddle at loc. VC VD
  55.   220      22F6      GOSUB 2F6                 call subr. to output score   
  56.   222      6000      V0=00                     set X coord of balls remaining
  57.   224      6100      V1=00                     set Y coord of balls remaining
  58.   226      A312      I=312                     get address of balls sprite
  59.   228      D011      DRAW V0 V1 1 BYTE         draw 4 of the five balls
  60.   22A      7008      V0=V0+8                   set X to loc. of 5th ball sprite
  61.   22C      A30E      I=30E                     get address of single ball sprite
  62.   22E      D011      DRAW V0 V1 1 BYTE         draw 5th ball
  63.   230      6040      V0=40                     set V0 to 40 for delay
  64.   232      F015      DELAY TIMER = V0          set delay timer
  65.   234      F007      V0 = DELAY TIMER          check status of delay timer
  66.   236      3000      IF V0=00 SKIP NEXT        if delay timer zero continue
  67.   238      1234      JUMP 234                  otherwise go check status again
  68.   23A      C60F      V6=RANDOM AND 0F          get random X coord for ball start
  69.   23C      671E      V7=1E                     set Y coord of ball start
  70.   23E      6801      V8=01                     set X direction to the right
  71.   240      69FF      V9=FF                     set Y direction to up
  72.   242      A30E      I=30E                     get address of ball sprite
  73.   244      D671      DRAW V6 V7 1 BYTE         draw ball at loc V6 V7
  74.   246      A310      I=310                     get address of paddle sprite
  75.   248      DCD1      DRAW VC VD 1 BYTE         draw paddle at loc. VC VD
  76.   24A      6004      V0=04                     set V0 to 04 for key number
  77.   24C      E0A1      IF KEY V0 NOT PRESSED SKIP NEXT 
  78.   24E      7CFE      VC=VC+FE                  set X coord to 2 to the left
  79.   250      6006      V0=06                     set V0 to 06 for key number
  80.   252      E0A1      IF KEY V0 NOT PRESSED SKIP NEXT
  81.   254      7C02      VC=VC+2                   set X coord to 2 to the right
  82.   256      603F      V0=3F                     set V0 right edge of screen
  83.   258      8C02      VC=VC AND V0              wrap paddle around if needed
  84.   25A      DCD1      DRAW VC VD 1 BYTE         draw paddle at loc. VC VD
  85.   25C      A30E      I=30E                     get address of ball sprite
  86.   25E      D671      DRAW V6 V7 1 BYTE         display ball at loc. V6 V7
  87.   260      8684      V6=V6+V8                  move ball in X direction by V8
  88.   262      8794      V7=V7+V9                  move ball in Y direction by V8
  89.   264      603F      V0=3F                     set highest X coord.
  90.   266      8602      V6=V6 AND V0              AND ball X pos. with V0
  91.   268      611F      V1=1F                     set highest Y coord
  92.   26A      8712      V7=V7 AND V1              AND ball Y pos. with V1
  93.   26C      471F      IF V7 != 1F SKIP NEXT     if ball not at bottom skip
  94.   26E      12AC      JUMP 2AC                  otherwise jump to 2AC
  95.   270      4600      IF V6 != 00 SKIP NEXT     if ball not at left side, skip
  96.   272      6801      V8=01                     else set X direction to right
  97.   274      463F      IF V6 != 3F SKIP NEXT     if ball not at right side, skip
  98.   276      68FF      V8=FF                     else set X direction to left
  99.   278      4700      IF V7 != 00 SKIP NEXT     if ball not at top, skip
  100.   27A      6901      V9=01                     else set Y direction down
  101.   27C      D671      DRAW V6 V7 1 BYTE         draw ball at loc. V6 V7
  102.   27E      3F01      IF VF = 1 SKIP NEXT       if there was a collision skip
  103.   280      12AA      JUMP 2AA                  otherwise jump to 2AA
  104.   282      471F      IF V7 != 1F SKIP NEXT     if ball not at bottom skip
  105.   284      12AA      JUMP 2AA                  otherwise jump to 2AA
  106.   286      6005      V0=05                     set V0 for 5 lines at screen top
  107.   288      8075      V0=V0-V7                  check if ball was in this region
  108.   28A      3F00      IF VF = 00 SKIP NEXT      if it was not then skip
  109.   28C      12AA      JUMP 2AA                  otherwise jump to 2AA
  110.   28E      6001      V0=01                     there was a collision
  111.   290      F018      SOUND TIMER = V0          so beep
  112.   292      8060      V0=V6                     get X coord of ball
  113.   294      61FC      V1=FC                     compute postion of the brick
  114.   296      8012      V0=V0 AND V1              that was hit
  115.   298      A30C      I=30C                     get address of brick sprite
  116.   29A      D071      DRAW V0 V7 1 BYTE         erase brick sprite by drawing
  117.   29C      60FE      V0=FE                     reverse the Y direction of the
  118.   29E      8903      V1=V1 XOR V0              ball sprite
  119.   2A0      22F6      GOSUB 2F6                 call subr. to update score
  120.   2A2      7501      V5=V5+1                   incr. bricks hit counter by one
  121.   2A4      22F6      GOSUB 2F6                 call subr. to update score
  122.   2A6      4560      IF V5 = 60 SKIP NEXT      if all bricks have been hit, skip
  123.   2A8      12DE      JUMP 2DE                  else infinite loop (game over)
  124.   2AA      1246      JUMP 246                  goto address 246
  125.   2AC      69FF      V9=FF                     ball at bottom so set direct. up
  126.   2AE      8060      V0=V6                     get X coord. of ball
  127.   2B0      80C5      V0=V0-VC                  intersect with paddle
  128.   2B2      3F01      IF VF = 01 SKIP NEXT      if intersect then skip
  129.   2B4      12CA      JUMP 2CA                  otherwise goto 2CA
  130.   2B6      6102      V1=02                     |
  131.   2B8      8015      V0=V0-V1                  |
  132.   2BA      3F01      IF VF = 1 SKIP NEXT       |
  133.   2BC      12E0      JUMP 2E0                  |
  134.   2BE      8015      V0=V0-V1                  | this portion determines the
  135.   2C0      3F01      IF VF = 1 SKIP NEXT       | direction that the ball should
  136.   2C2      12EE      JUMP 2EE                  | bounce.
  137.   2C4      8015      V0=V0-V1                  |
  138.   2C6      3F01      IF VF = 1 SKIP NEXT       |
  139.   2C8      12E8      JUMP 2E8                  |
  140.   2CA      6020      V0=20                     set beep delay      
  141.   2CC      F018      SOUND TIMER = V0          beep for lost ball
  142.   2CE      A30E      I=30E                     get addres for ball sprite
  143.   2D0      7EFF      VE=VE+FF                  remove one from ball count
  144.   2D2      80E0      V0=VE                     set V0 to ball count
  145.   2D4      8004      V0=V0+V0                  compute location of ball to erase
  146.   2D6      6100      V1=00                     set Y coord. to top line
  147.   2D8      D011      DRAW V0 V1 1 BYTE         erase ball from remaining
  148.   2DA      3E00      IF VE = 00 SKIP NEXT      if no balls remain, skip
  149.   2DC      1230      JUMP 230                  otherwise goto 230
  150.   2DE      12DE      JUMP 2DE                  jump to end of game
  151.   2E0      78FF      V8=V8+FF                  make ball go left
  152.   2E2      48FE      IF V8 != FE SKIP NEXT     if ball was not going left, skip
  153.   2E4      68FF      V8=FF                     else make it go left by 1 not 2
  154.   2E6      12EE      JUMP 2EE                  goto paddle beep
  155.   2E8      7801      V8=V8+1                   make ball go right
  156.   2EA      4802      IF V8 != 2 SKIP NEXT      if ball was not going right, skip
  157.   2EC      6801      V8=01                     else make it go right by 1 not 2
  158.   2EE      6004      V0=04                     set beep time for paddle hit
  159.   2F0      F018      SOUND TIMER = V0          turn on beep
  160.   2F2      69FF      V9=FF                     set ball direction to up
  161.   2F4      1270      JUMP 270                  goto 270
  162.   2F6      A314      I=314                     set address to BCD score location
  163.   2F8      F533      STORE BCD OF V5 IN I..I+2 store BCD of score
  164.   2FA      F265      READ FROM I..I(V2) 
  165.   2FC      F129      I=5 BYTE SPRITE CHAR IN V1  get font for tens value from V1
  166.   2FE      6337      V3=37                     set X coord. of score tens place
  167.   300      6400      V4=00                     set Y coord of score
  168.   302      D345      DRAW V3 V4 5 BYTES        draw tens place score #
  169.   304      7305      V3=V3+5                   set X coord. of score ones place
  170.   306      F229      I=5 BYTE SPRITE CHAR IN V2  get font for ones value from V2
  171.   308      D345      DRAW V3 V4 5 BYTES        draw ones place score #
  172.   30A      00EE      RETURN 
  173.   30C      E000                                brick sprite 
  174.   30E      8000                                ball sprite 
  175.   310      FC00                                paddle sprite 
  176.   312      AA00                                balls remaining sprite 
  177.   314      0000                                score storage 
  178.   316      0000                                score storage  
  179.                                                    _____        _______        
  180. *********************************    HP48SX       / ___ \      /__    (\     
  181. *                               * .----------.    ||   ||     /( _)  z) \   
  182. * Paul Vervalin                 * |]]]]]]].-.|    ||___||    |. V__ (_ \/|   
  183. *                               * |]]]]]]]| ||    \_____/    |   ( ) ) | |   
  184. * vervalin@AUSTIN.LOCKHEED.COM  * |]]]]]]]| ||   .-------.   [   |/  (_/ |  
  185. *                               * |]]]]]]]`-']---[ AMIGA ]__/ \  `.     /     
  186. ********************************* `----------'   `-------'     \_______/
  187.  
  188.  
  189.